Tweak the install script for windows nightlies
authorAlex Crichton <alex@alexcrichton.com>
Fri, 12 Sep 2014 03:06:39 +0000 (20:06 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 15 Sep 2014 16:42:32 +0000 (09:42 -0700)
.travis.install.deps.sh

index 22c5bc35280359362ad3d58c8bd8ce970a670e13..6f3cc5ce9a724ac3540493e3ad82dede20be8868 100755 (executable)
@@ -19,13 +19,15 @@ if [ "${TRAVIS}" = "true" ] && [ "${target}" = "unknown-linux-gnu" ]; then
     sudo apt-get install g++-multilib lib32stdc++6
 fi
 
+host=static-rust-lang-org.s3.amazonaws.com
+
 # Install both 64 and 32 bit libraries. Apparently travis barfs if you try to
 # just install the right ones? This should enable cross compilation in the
 # future anyway.
 if [ -z "${windows}" ]; then
-    curl -O https://static-rust-lang-org.s3.amazonaws.com/dist/rust-nightly-i686-$target.tar.gz
+    curl -O https://$host/dist/rust-nightly-i686-$target.tar.gz
+    curl -O https://$host/dist/rust-nightly-x86_64-$target.tar.gz
     tar xfz rust-nightly-i686-$target.tar.gz
-    curl -O https://static-rust-lang-org.s3.amazonaws.com/dist/rust-nightly-x86_64-$target.tar.gz
     tar xfz rust-nightly-x86_64-$target.tar.gz
 
     if [ "${BITS}" = "32" ]; then
@@ -44,16 +46,38 @@ if [ -z "${windows}" ]; then
     ./rust-nightly-$dst-$target/install.sh --prefix=rustc
     rm -rf rust-nightly-$src-$target
     rm -rf rust-nightly-$dst-$target
+    rm -f rust-nightly-i686-$target.tar.gz
+    rm -f rust-nightly-x86_64-$target.tar.gz
 else
     rm -rf *.exe rustc
+    # Right now we don't have *cargo* nightlies for 64-bit windows. This means
+    # that to bootstrap the 64-bit cargo nightlies, we need to build from the
+    # 32-bit cargo. This, however, has a runtime dependency on libgcc_s_dw2
+    # which is not present in the mingw-w64 64-bit shell. Hence we download both
+    # *rust* snapshots, and then when we're on a 64-bit windows host we copy the
+    # libgcc_s_dw2 dll from the 32-bit rust nightly into a location that will be
+    # in our PATH
+    #
+    # When cargo has a 64-bit nightly of its own, we'll only need to download
+    # the relevant windows nightly.
+    v32=i686-pc-mingw32
+    v64=x86_64-w64-mingw32
+    curl -O http://$host/dist/rust-nightly-$v32.exe
+    curl -O http://$host/dist/rust-nightly-$v64.exe
     if [ "${BITS}" = "64" ]; then
-        triple=x86_64-w64-mingw32
+        # innoextract comes from the mingw-w64-x86_64-innoextract package
+        innoextract rust-nightly-$v64.exe
+        mv app rustc
+        innoextract rust-nightly-$v32.exe
+        mv app/bin/libgcc_s_dw2-1.dll rustc/bin
+        rm -rf app
     else
-        triple=i686-pc-mingw32
+        # innounp came from a random download on the internet! (search google)
+        innounp -y -x rust-nightly-$v32.exe
+        mv '{app}' rustc
     fi
-    curl -O http://static-rust-lang-org.s3.amazonaws.com/dist/rust-nightly-$triple.exe
-    innounp -y -x rust-nightly-$triple.exe
-    mv '{app}' rustc
+    rm -f rust-nightly-$v32.exe
+    rm -f rust-nightly-$v64.exe
 fi
 
 set +x